# 列表的遍历
# 1. 直接遍历 复制一份
# a = [1, 2, 3, 4, 5]
# for elem in a:
#     print(elem)

# for e in a:
#     e += 10
#     print(e)
# print(a)

# 2.下标访问for,while
# for i in range(0, len(a)):
#     a[i] += 10
#     print(a[i])

# i = 0
# while i < len(a):
#     print(a[i])
#     i += 1

# append在末尾添加元素
a = [1, 2, 3, 4]
print(a)
a.append(6)
a.append("hello")
print(a)

# insert(pos,x)
b = [2, 4, 6, 8]
print(b)
b.insert(1, 66)
print(b)
b.insert(1000, 99)
print(b)
# len(b) - 1
b.insert(-1, 50)
print(b)
